import TemplateCode.Discount.ChildrenDiscount;
import TemplateCode.Discount.DiscountStrategy;
import TemplateCode.Discount.StudentDiscount;
import TemplateCode.Discount.VIPDiscount;
import TemplateCode.MovieTicket;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

public class Main {

    private static Logger logger = LogManager.getLogger(Main.class.getName());

    public static void main(String[] args) {

        System.out.println("------------策略模式-模版-并写入日志debug--------------");
        MovieTicket movieTicket = new MovieTicket();
        movieTicket.setOriginalPrice(80.0);

        DiscountStrategy strategy = new StudentDiscount();
        movieTicket.setDiscountStrategy(strategy);
        movieTicket.discountCalculate();
        System.out.println("学生票一张，原价："+movieTicket.getOriginalPrice()+"，打折后价格："+movieTicket.getDiscountPrice());
        logger.debug("日志：学生票一张，原价："+movieTicket.getOriginalPrice()+"，打折后价格："+movieTicket.getDiscountPrice());
        strategy=new ChildrenDiscount();
        movieTicket.setDiscountStrategy(strategy);
        movieTicket.discountCalculate();
        System.out.println("儿童票一张，原价："+movieTicket.getOriginalPrice()+"，打折后价格："+movieTicket.getDiscountPrice());
        logger.debug("日志：儿童票一张，原价："+movieTicket.getOriginalPrice()+"，打折后价格："+movieTicket.getDiscountPrice());
        strategy=new VIPDiscount();
        movieTicket.setDiscountStrategy(strategy);
        movieTicket.discountCalculate();
        System.out.println("VIP票一张，原价："+movieTicket.getOriginalPrice()+"，打折后价格："+movieTicket.getDiscountPrice());
        logger.debug("日志：VIP票一张，原价："+movieTicket.getOriginalPrice()+"，打折后价格："+movieTicket.getDiscountPrice());




    }
}